package jnpf.htgl.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.htgl.entity.ZcglHtglSkjhEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *
 * 收款计划
 * 版本： V3.2.0
 * 版权： 智果云科技（https://www.jnpfsoft.com）
 * 作者： JNPF开发平台组
 * 日期： 2025-01-21
 */
public interface ZcglHtglSkjhMapper extends BaseMapper<ZcglHtglSkjhEntity> {

    @Select("select " +
            "F_ID as id,F_CREATORUSERID as creatoruserid,F_CREATORTIME as creatortime,F_DESCRIPTION as description," +
            "F_PARENTID as parentid,RELATED_SPACE as relatedSpace,EXPENSE_ITEM as expenseItem,HS_UNIT_PRICE as hsUnitPrice," +
            "MONTHLY_RENT as monthlyRent,INTERVALL as intervall,PAYMENT_DATE as paymentDate,INCLUSIVE_AMOUNT as inclusiveAmount," +
            "EXCLUDING_AMOUNT as excludingAmount,TAX_RATE as taxRate" +
            " from zcgl_htgl_skjh t1 where t1.F_PARENTID=#{id} \n" +
            "UNION ALL\n" +
            "select " +
            "F_ID as id,F_CREATORUSERID as creatoruserid,F_CREATORTIME as creatortime,F_DESCRIPTION as description," +
            "F_PARENTID as parentid,RELATED_SPACE as relatedSpace,EXPENSE_ITEM as expenseItem,HS_UNIT_PRICE as hsUnitPrice," +
            "MONTHLY_RENT as monthlyRent,INTERVALL as intervall,PAYMENT_DATE as paymentDate,INCLUSIVE_AMOUNT as inclusiveAmount," +
            "EXCLUDING_AMOUNT as excludingAmount,TAX_RATE as taxRate" +
            " from zcgl_htgl_skjh_history t2 where t2.F_PARENTID=#{id}")
    List<ZcglHtglSkjhEntity> getSkjhs(String id);

    @Delete("delete from zcgl_htgl_skjh where zcgl_htgl_skjh=#{parentid}")
    void deleteByFid(String parentid);

    @Delete("delete from zcgl_htgl_skjh_history where zcgl_htgl_skjh=#{parentid}")
    void deleteHyByFid(String parentid);
}
